# 前端调试辅助脚本
Write-Host "=== 前端调试辅助 ===" -ForegroundColor Green

Write-Host "`n请按照以下步骤进行调试：" -ForegroundColor Cyan

Write-Host "1. 打开浏览器开发者工具 (F12)" -ForegroundColor White
Write-Host "2. 切换到 Console 标签页" -ForegroundColor White
Write-Host "3. 点击前端的'清理日志'按钮" -ForegroundColor White
Write-Host "4. 查看控制台是否有以下信息：" -ForegroundColor White
Write-Host "   - '=== cleanLogs函数被调用 ==='" -ForegroundColor Yellow
Write-Host "   - '清理日志按钮被点击了！'" -ForegroundColor Yellow
Write-Host "   - 任何错误信息" -ForegroundColor Red

Write-Host "`n5. 如果没有看到上述信息，可能的问题：" -ForegroundColor Cyan
Write-Host "   - JavaScript错误阻止了函数执行" -ForegroundColor Red
Write-Host "   - 函数定义有问题" -ForegroundColor Red
Write-Host "   - Vue组件没有正确加载" -ForegroundColor Red

Write-Host "`n6. 如果看到了函数调用信息，但清理失败，检查：" -ForegroundColor Cyan
Write-Host "   - 网络请求是否发送成功" -ForegroundColor Yellow
Write-Host "   - 后端API是否返回正确响应" -ForegroundColor Yellow
Write-Host "   - 日期格式是否正确" -ForegroundColor Yellow

Write-Host "`n7. 后端API测试结果：" -ForegroundColor Cyan
try {
    $response = Invoke-RestMethod -Uri "http://localhost:5252/api/log/statistics" -Method GET -TimeoutSec 5
    Write-Host "✓ 后端服务正常，总日志数: $($response.total)" -ForegroundColor Green
} catch {
    Write-Host "✗ 后端服务异常: $($_.Exception.Message)" -ForegroundColor Red
}

Write-Host "`n=== 调试指南完成 ===" -ForegroundColor Green 